<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <link class="theme" rel="stylesheet" type="text/css" href="./css/color/blue.css" />
</head>

<body>
    <header class="aui-bar aui-bar-nav header">
        <!-- <a class="aui-pull-left">
        <span class="aui-iconfont aui-icon-left"></span>
    </a> -->
        <div class="aui-title"><span>市管领导干部信息查询系统--自定义查询</span></div>
        <a class="aui-pull-right aui-btn">
            <span class="fa fa-user-circle-o" onclick="user()"></span>
        </a>
    </header>
    <div class="header-d"></div>
    <!-- 条件 -->
    <!-- <div class="list-t">
        <img src="images/cover_logo.png">
        <span>中共佳木斯市委组织部</span>
    </div> -->
    <div class="search">
        <ul>
            <li>
                <p>姓名：</p>
                <input class="text-1" type="text" name="name">
            </li>
            <li>
                <p>年龄：</p>
                <input class="text-2" type="text" name='symbol' placeholder="'>' 或  '<'">
                <span>-</span>
                <input class="text-2" type="text" name='age' placeholder="年龄">
            </li>
            <li>
                <p>性别：</p>
                <div class="aui-list-item-input" name='sex'>
                    <label><input class="aui-radio" type="radio" value='男' name="sex" checked>男</label>
                    <label><input class="aui-radio" type="radio" value='女' name="sex">女</label>
            </li>
            <li>
                <p>现任职务：</p>
                <input class="text-1" type="text" name='post'>
            </li>
            <li>
                <p>全日制学历：</p>
                <select class="text-1" id='education'>
              <option>无</option>
                <option>研究生</option>
                <option>大学</option>
                <option>大专</option>
                <option>中专</option>
                <option>博士</option>
                <option>硕士</option>
                <option>学士</option>
            </select>
            </li>
            <li>
                <p>全日制学位：</p>
                <select class="text-1" id='degree'>
                <option>无</option>
                <option>大学</option>
                <option>大专</option>
                <option>中专</option>
                <option>博士</option>
                <option>硕士</option>
                <option>学士</option>
            </select>
            </li>
            <li>
                <p>任职状态：</p>
                <select class="text-1" id='job'>
                <option>无</option>
                <option>现职</option>
                <option>离岗退休</option>
                <option>享受政策</option>
            </select>
            </li>
        </ul>
        <div class="search-btn">
            <button type="button" onclick="search()">搜索</button>
        </div>
        </div>

        <!-- 改变模板颜色 -->
        <!-- <div class="theme-x">
    <ul>
        <li class="theme-blue"></li>
        <li class="theme-red"></li>
        <li class="theme-green"></li>
        <li class="theme-orange"></li>
    </ul>
</div> -->
        <!-- <script>
    $(".theme-blue").on("click", function() {
        $(".theme").attr("href", "./css/color/blue.css")
        $api.setStorage('color', './css/color/blue.css');
    });
    $(".theme-red").on("click", function() {
        $(".theme").attr("href", "./css/color/red.css")
        $api.setStorage('color', './css/color/red.css');
    });
    $(".theme-green").on("click", function() {
        $(".theme").attr("href", "./css/color/green.css")
        $api.setStorage('color', './css/color/green.css');
    });
    $(".theme-orange").on("click", function() {
        $(".theme").attr("href", "./css/color/orange.css")
        $api.setStorage('color', './css/color/orange.css');
    });
</script> -->


</body>
<script type="text/javascript" src="./script/api.js"></script>

</html>
<script>
    function user() {
        api.openWin({
            name: 'user',
            url: './user.html',
        });
    }

    function search() {
        var name = $('input[name="name"]').val();
        sql = 'SELECT * FROM base_info WHERE ';
        if (name != '') {
            name = "'" + name + "'";
            nameSql = 'I01=' + name + ' AND';
            sql = sql + nameSql;
        }
        //年龄
        var symbol = $('input[name="symbol"]').val();
        var age = $('input[name="age"]').val();
        if (symbol != '' && age != '') {
            var date = getcurrent(age);
            date = "'" + date + "'";
            sql = sql + date + ' ' + symbol + ' I03 AND';
        }

        //性别
        var sex = $('input:radio[name="sex"]:checked').val();
        sex = "'" + sex + "'";
        sql = sql + ' I02 = ' + sex;


        // 现任职务
        var post = $('input[name="post"]').val();
        if (post != '') {
            post = "'%" + post + "%'";
            sql = sql + ' AND ' + "I16 LIKE " + post
        }

        var education = $('#education').val();
        if (education != '无') {
            education = "'%" + education + "%'";
            sql = sql + ' AND ' + "I24 LIKE " + education
        }

        var degree = $('#degree').val();
        if (degree != '无') {
            degree = "'%" + degree + "%'";
            sql = sql + ' AND ' + "I25 LIKE " + degree
        }


        var job = $('#job').val();
        if (job != '无') {
            job = "'%" + job + "%'";
            sql = sql + ' AND ' + "I46 LIKE " + job
        }

  // sql = sql + " AND Name not in('I52')";

//   var h;
//   if(window.orientation==180||window.orientation==0){
//         // alert("竖屏状态！")
//         h = api.winHeight - 50;
//    }
// if(window.orientation==90||window.orientation==-90){
//         // alert("横屏状态！")
//         h = api.winHeight;
//     }


        api.openFrame({
            name: 'classify-imgSearch',
            url: './classify-imgSearch.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: api.winHeight -50
            },
            pageParam: {
                sql: sql,
            },
            bounces: false,
            bgColor: 'rgba(0,0,0,0)',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });
        api.showProgress({
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

    }

    apiready = function() {
        var color = $api.getStorage('color');
        $(".theme").attr("href", color);
        var winName = api.winName;

    }



    function getcurrent(age) {
        //将一个月的日期填入搜索框
        var currentYear = new Date().getFullYear() - age;
        var currentMonth = new Date().getMonth() + 1;
        var currentDate = new Date().getDate();
        var current = currentYear + "-" + currentMonth + "-" + p(currentDate);
        return current;
    }

    function p(s) {
        return s < 10 ? '0' + s : s;
    }
</script>
